package com.xuecheng.system.init;

import com.xuecheng.common.enums.StatusAnnotation;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;

import java.util.Map;

/**
 * Created on 2021/04/07/0:14 周三
 *
 * @author Lantin
 */
//@Component
public class MyClassPathPkgScanner2 implements BeanDefinitionRegistryPostProcessor {
    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {

    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        Map<String, Object> beans= beanFactory.getBeansWithAnnotation(StatusAnnotation.class);
        for (String beanName : beans.keySet()) {
            System.out.println("beanName"+beanName);
        }

    }
}
